using HKB.Common;
using System;
using System.Data;
using System.Data.SqlClient;
using System.Web;
namespace HKB.Web
{
	public class Shop_FProductClass
	{
		private Conn conn;
		public DataRow thisDr;
		public Shop_FProductClass()
		{
			this.conn = Text.GetComponent<Conn>("conn", HttpContext.Current.CurrentHandler);
		}
		public Shop_FProductClass(Conn _conn)
		{
			this.conn = _conn;
		}
		public DataTable GetAllFProductClass()
		{
			return this.conn.GetDataTable("SELECT HLShop_FProductClass.* FROM HLShop_FProductClass");
		}
		public DataTable GetFProductClassByProductClassID(int F_ProductClassID)
		{
			IDbDataParameter dbDataParameter = this.conn.CreateParameter("@F_ProductClassID", DbType.Int32, F_ProductClassID);
			return this.conn.GetDataTable("SELECT HLShop_FProductClass.*  FROM HLShop_FProductClass WHERE F_ProductClassID=@F_ProductClassID", new IDbDataParameter[]
			{
				dbDataParameter
			});
		}
		public DataTable GetFProductClassByUserID(int UserID)
		{
			IDbDataParameter dbDataParameter = this.conn.CreateParameter("@UserID", DbType.Int32, UserID);
			return this.conn.GetDataTable("SELECT HLShop_FProductClass.* FROM HLShop_FProductClass where UserID=@UserID", new IDbDataParameter[]
			{
				dbDataParameter
			});
		}
		public void DeleteFProductClass(int F_ProductClassID)
		{
			SqlParameter sqlParameter = new SqlParameter("@F_ProductClassID", F_ProductClassID);
			this.conn.Execute("PR_DeleteFProductClass", new SqlParameter[]
			{
				sqlParameter
			});
		}
		public void UpdateFProductClass(string F_ProductClassName, string F_ProductClassRemark, int F_ProductClassID)
		{
			IDbDataParameter[] parameters = new IDbDataParameter[]
			{
				this.conn.CreateParameter("@F_ProductClassName", DbType.String, F_ProductClassName),
				this.conn.CreateParameter("@F_ProductClassRemark", DbType.String, F_ProductClassRemark),
				this.conn.CreateParameter("@F_ProductClassID", DbType.Int32, F_ProductClassID)
			};
			this.conn.Execute(" UPDATE [HLShop_FProductClass] SET [F_ProductClassName] = @F_ProductClassName,[F_ProductClassRemark] = @F_ProductClassRemark WHERE (([F_ProductClassID] = @F_ProductClassID))", parameters);
		}
		public void InsertFProductClass(string F_ProductClassName, int UserID, string F_ProductClassRemark)
		{
			IDbDataParameter[] parameters = new IDbDataParameter[]
			{
				this.conn.CreateParameter("@F_ProductClassName", DbType.String, F_ProductClassName),
				this.conn.CreateParameter("@F_ProductClassRemark", DbType.String, F_ProductClassRemark),
				this.conn.CreateParameter("@UserID", DbType.Int32, UserID)
			};
			this.conn.Execute("  INSERT INTO [HLShop_FProductClass] ([F_ProductClassName], [UserID], [F_ProductClassRemark]) VALUES (@F_ProductClassName, @UserID, @F_ProductClassRemark) ", parameters);
		}
	}
}
